<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Comparison Chart</title>
		<link rel="stylesheet" href="../../css/styles.css" type="text/css" />
		<script type="text/javascript" src="js/validation.js"></script>
	</head>
	<script type="text/javascript">
		  function showSearchForm(){
		    	document.getElementById("viewDiv").style.display = "block";
		  }
		  function setDisplay(){
		     var getDetailsField = document.getElementById("getDetailsField");
		     if(getDetailsField != null){
		        showSearchForm();
		     }
		  }
		  function validateFormOnSearch(theForm){
			var reason = "";
			
			reason +=validateSelectProduct(theForm.bitemSearch);
			if (reason !=""){
			alert("Error Message:\n" + reason);
			return false;
			}
			return true;
		}
	</script>
	<body onload="javascript:setDisplay();">
		<div id="container">
			<jsp:include page="/jsp/menu.jsp" />
				<div style="height: 420px;">
					<div class="path">
					<br><a href="home.htm"> Home </a>-&gt;
						<a> Account </a>-&gt;
						<a> Sale </a>-&gt;
						<a href="saleComparisonChart.htm"> Comparison Chart </a>
					</div>
					<div id="leftDiv" style="margin-left: 10px; margin-top: 20px">
						<b>Comparison Chart</b><br>
						<br>
						<fieldset style="height: 50px; width: 200px;background: #FFF;">
							<table cellpadding=20>
								<tr>
									<td><a href="javascript:showSearchForm()"> View Comparison
									Chart </a></td>
								</tr>
							</table>
						</fieldset>
					</div>
				</div>
			<form:form  method="POST" action="getSaleComparisonChart.htm" commandName="saleComparisonChart" onsubmit="return validateFormOnSearch(this)">
				<div id="viewDiv" class="maininfo" style="display: none">
					<div class="lable">
						Comparison Chart
					</div>
					<div id="searchForm">
						<table>
							<tr>
								<th>Enter Product Name <span class="mand-star">*</span></th>
								<td><form:select path="bitemSearch">
									<form:option value="" label="------Select------"></form:option>
									<c:forEach items="${model.bItemList}" var="buyerQuotation">
										<form:option value="${buyerQuotation.strItemName}">${buyerQuotation.strItemName}</form:option>
									</c:forEach>
								</form:select></td>
							</tr>
							<tr>
								<td></td>
								<td><input type="submit" value="search"></td>
							</tr>
						</table>
					</div>
					<c:if test="${!empty model.comparisonList}">
					<div id="viewTable">
						<table cellpadding="10">
							<tr>
								<th>Buyer Quote Id</th>
								<th>Quotation no.</th>
								<!--  <th>Buyer Name</th>>-->
								<th>Quantity</th>
								<th>Rate Quoted</th>
								<th>Generate</th>
							</tr>
							<c:forEach items="${model.comparisonList}" var="comparisonList">
							<tr>
								<td><c:out value="${comparisonList.numBuyQuotId}"></c:out></td>
								<td><c:out value="${comparisonList.strBuyQuoteNumber}"></c:out></td>
								<!--  <td><c:out value="${comparisonList.strBuyerName}"></c:out></td>-->
								<td><c:out value="${comparisonList.numItemQuantity}"></c:out></td>
								<td><c:out value="${comparisonList.strItemRate}"></c:out></td>
								<td><form:radiobutton path="buyerGenerate" value="" /></td>
							</tr>
							</c:forEach>
						</table>
					</div>
					</c:if>
				</div>
			</form:form>
			<c:if test="${model.isGet}">
				<input id="getDetailsField" type="hidden" name="getDetailsField"/>  
			</c:if>
		<div id="footer"><jsp:include page="/jsp/footer.jsp" /></div>
		</div>
	</body>
</html>